package com.qimingyu.recursion;

/**
 * @version 1.0
 * @Author doreaxon
 * @Date 2023/8/29 21:09
 * @注释 用递归倒序打印字符串
 */
public class PrintStrWithRecursion {

    static String str = "HelloWorld!";

    public void reversePrint(int index,String str){
        if (index == str.length()){
            return;
        }
        reversePrint(index + 1,str);
        System.out.print(str.charAt(index) + " ");
    }

    public static void main(String[] args) {
        PrintStrWithRecursion p = new PrintStrWithRecursion();
        p.reversePrint(0,str);
    }
}
